<template>
  <div>
    <life-cycle v-if="isShow"></life-cycle>
    <button @click="handleClick">click</button>
  </div>
</template>

<script>
import LifeCycle from './components/01 lifecycle-初始化.vue'
export default {
  components:{
    LifeCycle
  },
    data(){
      return {
        arr:[],
        isShow:true
      }
    },
    methods:{
      async handleClick(){
        this.isShow = false
        const api = 'http://ajax-api.itheima.net/api/books'
        // console.log(this.sayHi())
        // this.sayHi()
        // this.$http.get(api).then(res => {
        //   console.log(res)
        // })
        const res = await this.$http.get(api)
        this.arr = res.data.data
        console.log(this.arr)

      }
    }
}
</script>

<style>

</style>